from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func
from sqlalchemy import Column, DateTime

# 创建基类
Base = declarative_base()

# 自定义基类，添加通用字段
class BaseModel(Base):
    """所有模型的基类，提供通用字段和方法"""
    __abstract__ = True
    
    # 通用时间戳字段
    created_at = Column(DateTime(timezone=True), server_default=func.now())
    updated_at = Column(DateTime(timezone=True), onupdate=func.now()) 